<?php

namespace YouBaoLian\Application\Response;

use YouBaoLian\Http\Response;

class VehicleRenewalResponse extends Response
{

    /**
     * 续保信息
     * @var array $renewalInfo
     */
    private $renewalInfo = [];

    private $renewalDtoList = [];

    /**
     * 续保保司ID
     * @var string $renewSupplierId
     */
    private $renewSupplierId = '';

    /**
     * 交强险往年终保日期
     * @var string $ciEndDate
     */
    private $ciEndDate = '';

    /**
     * 商业险往年终保日期
     * @var string $biEndDate
     */
    private $biEndDate = '';

    /**
     * 往年险种
     * @var array $coverageList
     */
    private $coverageList = [];


    public function build(): Response
    {
        parent::build();
        $this->renewalInfo = $this->getBizContent('renewalDto');
        $this->renewalDtoList = $this->getBizContent('renewalDtoList');

        $this->ciEndDate = $this->renewalInfo['ciBeginDate'] ?? '';
        $this->biEndDate = $this->renewalInfo['biEndDate'] ?? '';
        $this->renewSupplierId = $this->renewalInfo['renewSupplierId'] ?? '';
        $this->coverageList = $this->renewalInfo['coverageList'] ?? '';

        return $this;
    }

    /**
     * @return bool
     */
    public function hasRenewalInfo(): bool
    {
        return !empty($this->biEndDate) || !empty($this->ciEndDate) || !empty($this->coverageList);
    }

    /**
     * @return array
     */
    public function getRenewalInfo(): array
    {
        return $this->renewalInfo;
    }

    /**
     * @return array
     */
    public function getRenewalDtoList(): array
    {
        return $this->renewalDtoList;
    }

    /**
     * @return string
     */
    public function getCiEndDate(): string
    {
        return $this->ciEndDate;
    }

    /**
     * @return string
     */
    public function getBiEndDate(): string
    {
        return $this->biEndDate;
    }

    /**
     * @return array
     */
    public function getCoverageList(): array
    {
        return $this->coverageList;
    }

    /**
     * @return string
     */
    public function getRenewSupplierId(): string
    {
        return $this->renewSupplierId;
    }

}
